package com.matrix.java.chap_05;

import java.util.Scanner;

/*
    对大写字母计数
 */
public class Ex5_50 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter a string: ");
        String str = input.nextLine();
        input.close();
        int uppercaseLetters = 0;
        for (int i = 0; i < str.length(); i++) {
            if (65 <= str.charAt(i) && str.charAt(i) <= 90) {
                uppercaseLetters++;
            }
        }
        System.out.println("The number of uppercase letters is " + uppercaseLetters);
    }
}
